package com.wx.clazzloader;

import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.Method;

/**
 * @description:
 * @author: wangxun
 * @createDate: 2021/5/8
 * @version: 1.0
 */
@Slf4j
public class MainTest {
    public static void main(String[] args) throws Exception {
        final MyClassLoader myClassLoader = new MyClassLoader();
        final Class<?> test = myClassLoader.loadClass("test");


        final Method main = test.getMethod("showInfo");
        main.invoke(null, null);


        final MyClassLoader myClassLoader2 = new MyClassLoader();
        final Class<?> test2 = myClassLoader2.loadClass("test");


        final Method main2 = test2.getMethod("showInfo");
        main2.invoke(null, null);
        log.info("1 的hashcode:{}",test.hashCode());
        log.info("2 的hashcode:{}",test2.hashCode());
        log.info("看看两个想用的clazz 是不是相等：{}",test==test2);
    }
}
